<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>级联数据列表</title>

    <link href="/Application/Admin/Public/css/base.css" rel="stylesheet">
    <link rel="stylesheet" href="/Application/Admin/Public/custom/uimaker/easyui.css">
    <link rel="stylesheet" type="text/css" href="/Application/Admin/Public/custom/uimaker/icon.css">
    <link rel="stylesheet" href="/Application/Admin/Public/css/providers.css">
    <link rel="stylesheet" href="/Application/Admin/Public/css/detial.css">

</head>
<body>

<div class="container" style="padding:10px 30px;">
    <a href="<?php echo U('Prop/index');?>" class="easyui-linkbutton" iconCls="icon-back" >返回</a>
</div>


<div class="contractinfo-table">
  <div id="myModal" class="modal close">
      <!--<span >×</span>-->
      <img class="modal-content" id="imgInfo">
      <div id="caption"></div>
  </div>
<div class="summary">
    
     <form id="addpic" method="post" novalidate="novalidate" enctype="multipart/form-data" style='margin-top: 30px;'>
      <input type="hidden" id="action" name="action">
   <!--  <form id="addpic" method="post" novalidate="novalidate" action='<?php echo U("Prop/editImg");?>' enctype="multipart/form-data" style='margin-top: 30px;'>
         <button type="submit">tijao</button> -->
       <div class="binfo">
          <ul>
          <li style="border-right: 1px solid #5bbc9a">
        <input type="hidden" value="<?php echo ($data["itemid"]); ?>" name='itemid'></input>
        <div><label>应用名称:</label><input value="<?php echo ($data["title"]); ?>" type='text' name='title' class='easyui-textbox minp' data-options="required:true" style="height:28px" /></div>
        <div>
        <label>是否绑定:</label>
            <?php if($data["isbind"] == 1): ?><input type="radio" name="isbind" value="1" checked>是</input>
            <input type="radio" name="isbind" value="0">否</input>
            <?php else: ?><input type="radio" name="isbind" value="1">是</input>
            <input type="radio" name="isbind" value="0"  checked>否</input><?php endif; ?>
        </div>
        </li>
        <li>
        <div><label>排序:</label><input class="easyui-numberspinner minp" value="<?php echo ($data["orderid"]); ?>" name="orderid" data-options="increment:1,required:true" style="height:30px;"></div>
        <div><label>价格:</label><input  class='minp' value="<?php echo ($data["cnum"]); ?>" type='text' name='cnum' data-options="required:true" class="easyui-textbox" /></div>
        </li>
          <div style="clear: both;"></div>
          </ul>
        </div>
        <hr/>
        <div class="binfo">
          <ul>
          <li style="border-right: 1px solid #5bbc9a">
            <div><label>游戏ID:</label>

              <select id="gameid" name="gameid" required='true' style="width: 153px;height: 30px;">
                  <option value="">请选择</option>
                  <?php if(is_array($game_id)): $i = 0; $__LIST__ = $game_id;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i; if($vo["gameid"] == $data[gameid]): ?><option value="<?php echo ($vo["gameid"]); ?>" selected>ID:<?php echo ($vo["gameid"]); ?>,<?php echo ($vo["game"]); ?></option>
                        <?php else: ?>  
                      <option value="<?php echo ($vo["gameid"]); ?>">ID:<?php echo ($vo["gameid"]); ?>,<?php echo ($vo["game"]); ?></option><?php endif; endforeach; endif; else: echo "" ;endif; ?> 
              </select>
          </div>


          </li>
           <li>

              <div><label>哪种货币购买:</label>
              <select id="currencyid" name="currencyid" required='true' style="width: 153px;height: 30px;">
              <option value="">请选择</option> 
                  <?php if(is_array($currency_id)): $i = 0; $__LIST__ = $currency_id;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i; if($vo["curyid"] == $data[currencyid]): ?><option value="<?php echo ($vo["curyid"]); ?>" selected>ID:<?php echo ($vo["curyid"]); ?>,<?php echo ($vo["currency"]); ?></option>
                        <?php else: ?>  
                      <option value="<?php echo ($vo["curyid"]); ?>">ID:<?php echo ($vo["curyid"]); ?>,<?php echo ($vo["currency"]); ?></option><?php endif; endforeach; endif; else: echo "" ;endif; ?> 
              </select>


          </div>
          </li>
          <div style="clear: both;"></div>
          </ul>
        </div>
          <hr/>
          <div class="binfo">
          <ul>
          <li style="border-right: 1px solid #5bbc9a">
          <div><label>道具ID:</label><span><?php echo ($data["itemid"]); ?></span></div>
          <div><label>操作人:</label><span><?php echo ($data["admin"]); ?></span></div>
          <div><label>创建时间:</label><span><?php echo ($data["createtime"]); ?></span></div>
          <div><label>修改时间:</label><span><?php echo ($data["updatetime"]); ?></span></div>
          <div><label>ID:</label><span><?php echo ($data["id"]); ?></span></div>

          </li>
           <li>
          <div class="pic onel">
              <label>图标:</label>
              <input value="<?php echo ($data["icon"]); ?>" type='hidden' name='icon'>
              <?php if(!empty($data["icon"])): ?><a href="javascript:void(0)" onclick = "imdBig()"> <img class='myImg' style="height: 100px;" src ='<?php echo ($data["icon"]); ?>'></a><?php endif; ?>
                <div style="clear: both;"></div>
          </div>

          <div><label>上传图片:</label>
            <input id="fb4" class="easyui-filebox" name="icon[]" style="width:150px" data-options="label:'图片上传',prompt:'选择图片',onChange:function(){lookImg(4)}" >
            <div style="margin:24px"id="addImage4"></div>
          </div>
          </li>
          <div style="clear: both;"></div>
          </ul>
        </div>
    </form>
    
    <hr/>
    <div id="dlg-buttons">
      <a style="margin: 10px 50px;" href="javascript:void(0)" class="easyui-linkbutton" id="btnAddOK" iconcls="icon-ok" onclick="btnAddOK()">保存</a>
    </div>
  </div>

</div>




<script type="text/javascript" src="/Application/Admin/Public/custom/jquery.min.js"></script>
<script type="text/javascript" src="/Application/Admin/Public/custom/jquery.easyui.min.js"></script>
<script type="text/javascript" src="/Application/Admin/Public/custom/easyui-lang-zh_CN.js"></script>
<script>


$("input").blur(function(){
  $(this).css("border","#aaa solid 1px");
});

$("input").focus(function(){
  $(this).css("border","#1da02b  solid 1.5px");
});

  function btnAddOK() {
        $('#addpic').form('submit',{
            url: '<?php echo U("Prop/editImg");?>',
            onSubmit: function(){
                return $(this).form('validate');
            },
            success: function(result){
              if(result>0){
                $.messager.alert('提示','修改成功!','info',function(){
                    reload();
                });
              }else{
                $.messager.show({
                    title: '错误提示',
                    msg: '修改失败'
                });
              }    
            }
        });
    }

    $('.del').click(function(){
        $(this).parent().remove();
    });



    // 修改货比选项
     $("#gameid").change(function(){
      var gameid=$(this).val();
      $("#currencyid").empty(); 
      // alert(gameid);
      $.ajax({
        url:'<?php echo U("Prop/cury");?>',
        data:{
          gameid:gameid,
        },
        dataType:"json",
        success:function(data){
          var cury = data.cury;
          var option=$("<option></option>");
          $(option).val("0");
          $(option).html("请选择");
          $("#currencyid").html(option);
          for(var i in cury){
            var option=$("<option></option>");
            $(option).val(cury[i]['curyid']);
            $(option).html('ID:'+cury[i]['curyid']+','+cury[i]['currency']);
            $("#currencyid").append(option);
          }
        }
      });
    });



















    // 上传图片预览
    function lookImg(x){
      if(x==2){
        $('.iconimg').remove();
      }else if(x==3){
        $('.poimg').remove();
      }else if(x==4){
        $('.adimg').remove();
      }
      var dd = 'aaa'+x;
        var dd = $("#fb"+x).next().find('input[type=file]')[0];
        if (dd.files && dd.files[0]){
          // 更换图片时清空原图片展示内容
            $('#addImage'+x).html('');
             for(var i=0;i<dd.files.length;i++){
                var reader = new FileReader(dd.files[i]);
                reader.onload = function(e){
            //append为在元素中的末尾添加内容
                    $('#addImage'+x).append("<img class='addimg' src='"+e.target.result+"'height='50px;'/>");
                }
                reader.readAsDataURL(dd.files[i]);
             }
        }
    }

     function reload(){
        window.location.reload();
    }

/**
 * 点击设置图片放大
 */
function imdBig() {

    var modal = document.getElementById('myModal');
    var modalImg = document.getElementById("imgInfo");
    var captionText = document.getElementById("caption");
    $(".myImg").on("click",function(){
        modal.style.display = "block";
        modalImg.src = this.src;
        modalImg.alt = this.alt;
        captionText.innerHTML = this.alt;
    });
    var span = document.getElementsByClassName("close")[0];
    span.onclick = function() {
        modal.style.display = "none";
    }
}


</script>
</body>
</html>